Aggregate functions (AF):

   In database management an aggregate function or aggregation function is a function where the values of multiple rows are grouped together to form a single summary value.

Types AF's:
1. min
2. max
3. count
4. sum
5. avg


Q: Find the min sal from the emp?
Ans: select min(<colName>) from <tableName>;


Q: Find the max sal from emp?
Ans: select Max(<colName>) from <tableName>;


Q: Find the count of the rows in the column/table?
Ans:
select count(<colName>) from <tableName>;
select count(*) from <tableName>;


Q: Find the sum of sal from emp?
Ans: select sum(<colName>) from <tableName>;


Q: Find the avg of column values?
Ans:
average = Total value from the column/no. of rows
select avg(<colName>) from <tableName>;


Q: Find the max salary for each department from emp table?
Ans:
select deptno, max(sal) from emp group by deptno;

Q: Can we use multiple aggregate functions together in a single query?
Ans:
select min(sal) as minimum, max(sal) as maximum, avg(sal) as average from emp;